Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Cannot parse optic _ && true #160 #161

Closed
wants to merge 4 commits into from
Closed

fix Cannot parse optic _ && true #160 #161

wants to merge 4 commits into from

Conversation

jw3126
Copy link
Member

@jw3126 jw3126 commented Jul 27, 2024

fix #160

@aplavin
Copy link
Member

aplavin commented Jul 27, 2024

It doesn't affect optics that happen to include the actual symbol, right?

julia> :&&
:&&

@jw3126
Copy link
Member Author

jw3126 commented Jul 28, 2024

It doesn't affect optics that happen to include the actual symbol, right?

julia> :&&
:&&

You mean like this?

julia> @o (_[:&&])
(@o _[:&&])

@aplavin
Copy link
Member

aplavin commented Aug 26, 2024

Is there anything special with && and ||? @o nautrally doesn't support lots of Julia constructions throwing the same error:

julia> @o x && _
julia> @o x -> _
julia> @o _ ? x : y
julia> @o _, x
julia> @o (_, x)
# all of these throw the same:
ERROR: LoadError: ArgumentError: Cannot parse optic <...>. Lens expressions must start with _, got <...> instead.

Of course the reason is in all of these cases it makes little sense to call set() on such a structure – that's why Accessors refuses to even parse it.
I also like better error messages, but listing specific things we do not support seems unrealistic.

Maybe, phrasing of the error message can be improved instead? What do you think?

@jw3126 jw3126 closed this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot parse optic _ && true
2 participants